{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# chart module\n",
    "\n",
    "This module relies on `pygal` library, so the returned charts are instances of `pygal.chart`. See options at \n",
    "[pygal site][1]\n",
    "\n",
    "I made a JavaScript 'equivalent': https://code.earthengine.google.com/b2922b860b85c1120250794fb82dfda8\n",
    "\n",
    "  [1]: http://www.pygal.org/en/latest/documentation/index.html"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import ee\n",
    "ee.Initialize()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from ipygee import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_site = ee.Geometry.Point([-71, -42])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_feat = ee.Feature(test_site, {'name': 'test feature', 'buffer':0})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_featcol = ee.FeatureCollection([\n",
    "    test_feat, \n",
    "    test_feat.buffer(100).set('name', 'buffer 100', 'buffer', 100),\n",
    "    test_feat.buffer(1000).set('name', 'buffer 1000', 'buffer', 1000)\n",
    "])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Time Series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "col = ee.ImageCollection('COPERNICUS/S2').filterBounds(test_site)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "time_series = col.filterDate('2018-01-01', '2018-04-01')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "bands = ['B1', 'B2', 'B3']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## **Image.series**\n",
    "Chart band values across images in relation with a property or a band"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "chart_ts = chart.Image.series(**{\n",
    "    'imageCollection': time_series, \n",
    "    'region': test_site,\n",
    "    'scale': 10,\n",
    "    'bands': bands,\n",
    "    'label_bands':['band B1', 'B2 band', 'this is B3'],\n",
    "    'properties':['CLOUD_COVERAGE_ASSESSMENT'],\n",
    "    'label_properties':['CLOUD_COVER']\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "5001c69bfc0c409db5f842678a119f4f",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HTML(value='<embed src=data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTg…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "chart_ts.renderWidget(width='50%')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>this is B3</th>\n",
       "      <th>B2 band</th>\n",
       "      <th>band B1</th>\n",
       "      <th>CLOUD_COVER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-01-01 14:37:52.570</th>\n",
       "      <td>2673.0</td>\n",
       "      <td>2749.0</td>\n",
       "      <td>3622.0</td>\n",
       "      <td>88.2101</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-06 14:43:00.500</th>\n",
       "      <td>6483.0</td>\n",
       "      <td>6841.0</td>\n",
       "      <td>6989.0</td>\n",
       "      <td>98.1513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-16 14:38:41.740</th>\n",
       "      <td>1012.0</td>\n",
       "      <td>1042.0</td>\n",
       "      <td>1196.0</td>\n",
       "      <td>0.0646</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-21 14:41:57.890</th>\n",
       "      <td>1035.0</td>\n",
       "      <td>1070.0</td>\n",
       "      <td>1232.0</td>\n",
       "      <td>58.2937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-26 14:40:02.120</th>\n",
       "      <td>1038.0</td>\n",
       "      <td>1082.0</td>\n",
       "      <td>1210.0</td>\n",
       "      <td>0.2448</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-05 14:36:43.690</th>\n",
       "      <td>1037.0</td>\n",
       "      <td>1072.0</td>\n",
       "      <td>1196.0</td>\n",
       "      <td>0.0204</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-10 14:42:58.290</th>\n",
       "      <td>4290.0</td>\n",
       "      <td>4153.0</td>\n",
       "      <td>4730.0</td>\n",
       "      <td>30.9238</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-15 14:40:26.370</th>\n",
       "      <td>1020.0</td>\n",
       "      <td>1069.0</td>\n",
       "      <td>1212.0</td>\n",
       "      <td>0.0000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-20 14:33:53.510</th>\n",
       "      <td>1036.0</td>\n",
       "      <td>1077.0</td>\n",
       "      <td>1230.0</td>\n",
       "      <td>0.0121</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-25 14:37:50.240</th>\n",
       "      <td>1019.0</td>\n",
       "      <td>1091.0</td>\n",
       "      <td>1234.0</td>\n",
       "      <td>0.4717</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-02 14:43:01.890</th>\n",
       "      <td>1052.0</td>\n",
       "      <td>1094.0</td>\n",
       "      <td>1228.0</td>\n",
       "      <td>0.0000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-07 14:36:40.690</th>\n",
       "      <td>1055.0</td>\n",
       "      <td>1076.0</td>\n",
       "      <td>1220.0</td>\n",
       "      <td>0.0148</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-12 14:36:45.680</th>\n",
       "      <td>4814.0</td>\n",
       "      <td>4903.0</td>\n",
       "      <td>5176.0</td>\n",
       "      <td>16.0556</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-17 14:36:42.690</th>\n",
       "      <td>4792.0</td>\n",
       "      <td>5218.0</td>\n",
       "      <td>5532.0</td>\n",
       "      <td>95.7127</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-22 14:36:47.680</th>\n",
       "      <td>1316.0</td>\n",
       "      <td>1391.0</td>\n",
       "      <td>1467.0</td>\n",
       "      <td>56.3747</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-27 14:32:51.510</th>\n",
       "      <td>1318.0</td>\n",
       "      <td>1378.0</td>\n",
       "      <td>1521.0</td>\n",
       "      <td>51.1411</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                         this is B3  B2 band  band B1  CLOUD_COVER\n",
       "2018-01-01 14:37:52.570      2673.0   2749.0   3622.0      88.2101\n",
       "2018-01-06 14:43:00.500      6483.0   6841.0   6989.0      98.1513\n",
       "2018-01-16 14:38:41.740      1012.0   1042.0   1196.0       0.0646\n",
       "2018-01-21 14:41:57.890      1035.0   1070.0   1232.0      58.2937\n",
       "2018-01-26 14:40:02.120      1038.0   1082.0   1210.0       0.2448\n",
       "2018-02-05 14:36:43.690      1037.0   1072.0   1196.0       0.0204\n",
       "2018-02-10 14:42:58.290      4290.0   4153.0   4730.0      30.9238\n",
       "2018-02-15 14:40:26.370      1020.0   1069.0   1212.0       0.0000\n",
       "2018-02-20 14:33:53.510      1036.0   1077.0   1230.0       0.0121\n",
       "2018-02-25 14:37:50.240      1019.0   1091.0   1234.0       0.4717\n",
       "2018-03-02 14:43:01.890      1052.0   1094.0   1228.0       0.0000\n",
       "2018-03-07 14:36:40.690      1055.0   1076.0   1220.0       0.0148\n",
       "2018-03-12 14:36:45.680      4814.0   4903.0   5176.0      16.0556\n",
       "2018-03-17 14:36:42.690      4792.0   5218.0   5532.0      95.7127\n",
       "2018-03-22 14:36:47.680      1316.0   1391.0   1467.0      56.3747\n",
       "2018-03-27 14:32:51.510      1318.0   1378.0   1521.0      51.1411"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chart_ts.dataframe"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## **Image.seriesByRegion**\n",
    "Chart the value of one band in different regions in relation with a property or a band"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "chart_ts_region = chart.Image.seriesByRegion(**{\n",
    "    'imageCollection': time_series,\n",
    "    'reducer': ee.Reducer.median(),\n",
    "    'regions': test_featcol,\n",
    "    'scale': 10,\n",
    "    'band': 'B11',\n",
    "    'seriesProperty': 'name'\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "95b7526f5b6249adbe97144edbd1bcb6",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HTML(value='<embed src=data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTg…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "chart_ts_region.renderWidget(width=800)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>this is B3</th>\n",
       "      <th>B2 band</th>\n",
       "      <th>band B1</th>\n",
       "      <th>CLOUD_COVER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-01-01 14:37:52.570</th>\n",
       "      <td>2673.0</td>\n",
       "      <td>2749.0</td>\n",
       "      <td>3622.0</td>\n",
       "      <td>88.2101</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-06 14:43:00.500</th>\n",
       "      <td>6483.0</td>\n",
       "      <td>6841.0</td>\n",
       "      <td>6989.0</td>\n",
       "      <td>98.1513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-16 14:38:41.740</th>\n",
       "      <td>1012.0</td>\n",
       "      <td>1042.0</td>\n",
       "      <td>1196.0</td>\n",
       "      <td>0.0646</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-21 14:41:57.890</th>\n",
       "      <td>1035.0</td>\n",
       "      <td>1070.0</td>\n",
       "      <td>1232.0</td>\n",
       "      <td>58.2937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-26 14:40:02.120</th>\n",
       "      <td>1038.0</td>\n",
       "      <td>1082.0</td>\n",
       "      <td>1210.0</td>\n",
       "      <td>0.2448</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-05 14:36:43.690</th>\n",
       "      <td>1037.0</td>\n",
       "      <td>1072.0</td>\n",
       "      <td>1196.0</td>\n",
       "      <td>0.0204</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-10 14:42:58.290</th>\n",
       "      <td>4290.0</td>\n",
       "      <td>4153.0</td>\n",
       "      <td>4730.0</td>\n",
       "      <td>30.9238</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-15 14:40:26.370</th>\n",
       "      <td>1020.0</td>\n",
       "      <td>1069.0</td>\n",
       "      <td>1212.0</td>\n",
       "      <td>0.0000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-20 14:33:53.510</th>\n",
       "      <td>1036.0</td>\n",
       "      <td>1077.0</td>\n",
       "      <td>1230.0</td>\n",
       "      <td>0.0121</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-25 14:37:50.240</th>\n",
       "      <td>1019.0</td>\n",
       "      <td>1091.0</td>\n",
       "      <td>1234.0</td>\n",
       "      <td>0.4717</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-02 14:43:01.890</th>\n",
       "      <td>1052.0</td>\n",
       "      <td>1094.0</td>\n",
       "      <td>1228.0</td>\n",
       "      <td>0.0000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-07 14:36:40.690</th>\n",
       "      <td>1055.0</td>\n",
       "      <td>1076.0</td>\n",
       "      <td>1220.0</td>\n",
       "      <td>0.0148</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-12 14:36:45.680</th>\n",
       "      <td>4814.0</td>\n",
       "      <td>4903.0</td>\n",
       "      <td>5176.0</td>\n",
       "      <td>16.0556</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-17 14:36:42.690</th>\n",
       "      <td>4792.0</td>\n",
       "      <td>5218.0</td>\n",
       "      <td>5532.0</td>\n",
       "      <td>95.7127</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-22 14:36:47.680</th>\n",
       "      <td>1316.0</td>\n",
       "      <td>1391.0</td>\n",
       "      <td>1467.0</td>\n",
       "      <td>56.3747</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-03-27 14:32:51.510</th>\n",
       "      <td>1318.0</td>\n",
       "      <td>1378.0</td>\n",
       "      <td>1521.0</td>\n",
       "      <td>51.1411</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                         this is B3  B2 band  band B1  CLOUD_COVER\n",
       "2018-01-01 14:37:52.570      2673.0   2749.0   3622.0      88.2101\n",
       "2018-01-06 14:43:00.500      6483.0   6841.0   6989.0      98.1513\n",
       "2018-01-16 14:38:41.740      1012.0   1042.0   1196.0       0.0646\n",
       "2018-01-21 14:41:57.890      1035.0   1070.0   1232.0      58.2937\n",
       "2018-01-26 14:40:02.120      1038.0   1082.0   1210.0       0.2448\n",
       "2018-02-05 14:36:43.690      1037.0   1072.0   1196.0       0.0204\n",
       "2018-02-10 14:42:58.290      4290.0   4153.0   4730.0      30.9238\n",
       "2018-02-15 14:40:26.370      1020.0   1069.0   1212.0       0.0000\n",
       "2018-02-20 14:33:53.510      1036.0   1077.0   1230.0       0.0121\n",
       "2018-02-25 14:37:50.240      1019.0   1091.0   1234.0       0.4717\n",
       "2018-03-02 14:43:01.890      1052.0   1094.0   1228.0       0.0000\n",
       "2018-03-07 14:36:40.690      1055.0   1076.0   1220.0       0.0148\n",
       "2018-03-12 14:36:45.680      4814.0   4903.0   5176.0      16.0556\n",
       "2018-03-17 14:36:42.690      4792.0   5218.0   5532.0      95.7127\n",
       "2018-03-22 14:36:47.680      1316.0   1391.0   1467.0      56.3747\n",
       "2018-03-27 14:32:51.510      1318.0   1378.0   1521.0      51.1411"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chart_ts.dataframe"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chart band values in one image across features in relation with a property value or a band"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "chart_band = chart.Image.bandsByRegion(**{\n",
    "    'image': ee.Image(time_series.first()), \n",
    "    'collection': test_featcol,\n",
    "    'reducer': 'mean',\n",
    "    'scale': 10,\n",
    "    'bands': ['B1', 'B2', 'B3'],\n",
    "    'xProperty': 'buffer', # You can use a band too!\n",
    "    'labels': ['B1 mean', 'B2 mean', 'B3 mean']\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "f14ce1a54a0a45039745396015011897",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HTML(value='<embed src=data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTg…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "chart_band.renderWidget(width=800)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>B1 mean</th>\n",
       "      <th>B2 mean</th>\n",
       "      <th>B3 mean</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>3622.000000</td>\n",
       "      <td>2749.000000</td>\n",
       "      <td>2673.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>3547.196452</td>\n",
       "      <td>2781.726426</td>\n",
       "      <td>2665.863711</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1000</th>\n",
       "      <td>3373.623957</td>\n",
       "      <td>2983.575209</td>\n",
       "      <td>2811.374592</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          B1 mean      B2 mean      B3 mean\n",
       "0     3622.000000  2749.000000  2673.000000\n",
       "100   3547.196452  2781.726426  2665.863711\n",
       "1000  3373.623957  2983.575209  2811.374592"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chart_band.dataframe"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Concatenate Charts"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Concatenate mean with median"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "chart_band_median = chart.Image.bandsByRegion(**{\n",
    "    'image': ee.Image(time_series.first()), \n",
    "    'collection': test_featcol,\n",
    "    'reducer': 'median',\n",
    "    'scale': 10,\n",
    "    'bands': ['B1', 'B2', 'B3'],\n",
    "    'xProperty': 'buffer', # You can use a band too!\n",
    "    'labels': ['B1 median', 'B2 median', 'B3 median']\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "dfca5f5f2d0a4491a583afcee7933ee1",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HTML(value='<embed src=data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTg…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "chart_band_median.renderWidget(width=800)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "median_mean = chart_band_median.cat(chart_band)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "021381531b1f48dc8402456d65e06e92",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HTML(value='<embed src=data:image/svg+xml;charset=utf-8;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0ndXRmLTg…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "median_mean.renderWidget(width=800)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>B2 median</th>\n",
       "      <th>B3 mean</th>\n",
       "      <th>B1 mean</th>\n",
       "      <th>B2 mean</th>\n",
       "      <th>B1 median</th>\n",
       "      <th>B3 median</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2749.000000</td>\n",
       "      <td>2673.000000</td>\n",
       "      <td>3622.000000</td>\n",
       "      <td>2749.000000</td>\n",
       "      <td>3622.000</td>\n",
       "      <td>2673.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>2781.000000</td>\n",
       "      <td>2665.863711</td>\n",
       "      <td>3547.196452</td>\n",
       "      <td>2781.726426</td>\n",
       "      <td>3563.000</td>\n",
       "      <td>2640.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1000</th>\n",
       "      <td>2983.859858</td>\n",
       "      <td>2811.374592</td>\n",
       "      <td>3373.623957</td>\n",
       "      <td>2983.575209</td>\n",
       "      <td>3496.375</td>\n",
       "      <td>2854.880285</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        B2 median      B3 mean      B1 mean      B2 mean  B1 median  \\\n",
       "0     2749.000000  2673.000000  3622.000000  2749.000000   3622.000   \n",
       "100   2781.000000  2665.863711  3547.196452  2781.726426   3563.000   \n",
       "1000  2983.859858  2811.374592  3373.623957  2983.575209   3496.375   \n",
       "\n",
       "        B3 median  \n",
       "0     2673.000000  \n",
       "100   2640.666667  \n",
       "1000  2854.880285  "
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "median_mean.dataframe"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
